package com.supreme.commonboot.utils;

import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class ReturnEntity<T> {

    private boolean success = Boolean.TRUE;

    private int code = 0;

    private String message;

    private T data;

    public ReturnEntity<T> fault() {
        this.success = Boolean.FALSE;
        return this;
    }

    public ReturnEntity<T> fault(int code) {
        this.code = code;
        return this.fault();
    }

    public ReturnEntity<T> fault(String message) {
        this.message = message;
        return this.fault();
    }

    public ReturnEntity<T> fault(int code, String message) {
        this.message = message;
        return this.fault(code);
    }

    public ReturnEntity<T> fault(String message, int code) {
        this.code = code;
        return this.fault(message);
    }
}
